<?php
declare (strict_types = 1);

namespace app\model;

class Delivery extends BaseModel
{
    protected $name = 'delivery';
    
    // 密码修改器
    public function setPasswordAttr($value)
    {
        return password_hash($value, PASSWORD_DEFAULT);
    }
    
    // 验证密码
    public function verifyPassword($password)
    {
        return password_verify($password, $this->password);
    }
    
    // 关联订单
    public function orders()
    {
        return $this->hasMany(Order::class);
    }
} 